import {RouteRecordRaw} from "vue-router";

import MainView from "@/pages/Main/MainView.vue";
import MessageContent from "@/pages/Main/TalkPages/MessageContent/MessageContent.vue";
import TalkContainer from "@/pages/Main/TalkPages/TalkContainer.vue";
import MessageWindow from "@/components/MessageWindow/MessageWindow.vue";

// 主页面路由
const mainRoutes: RouteRecordRaw[] = [
    {
        path: '/main',
        name: 'main',
        component: MainView,
        redirect: {name: "talk"},
        children: [
            {
                path: "talk",
                name: "talk",
                component: TalkContainer,
                redirect: {name: 'message'},
                children: [
                    {
                        path: 'message',
                        name: 'message',
                        component: MessageContent,
                        children: [
                            {
                                name: 'msg_window',
                                path: 'msg_window/:msg_uid',
                                component: MessageWindow,
                            }
                        ]
                    }
                ],
                meta: {
                    index: 1
                },
            },
            {
                path: "friend",
                name: "friend",
                redirect: {name: "friendlist"},
                meta: {
                    index: 2
                },
                component: () => import("@/pages/Main/FriendPages/FriendContainer.vue"),
                children: [
                    {
                        path: "friendlist",
                        name: "friendlist",
                        component: () => import("@/pages/Main/FriendPages/FriendContent/FriendContent.vue"),
                        // 配置url别名
                        //      例：localhost/main/friendlist  === localhost/friendlist
                        alias: ['/friendlist']
                    }
                ]
            }
        ]
    }
]

export default mainRoutes